import { Component, OnInit, Input } from '@angular/core';
import { Router } from '@angular/router';
import { GlobalService } from '../../global.service';


@Component({
  selector: 'app-header',
  templateUrl: './header.component.html',
  styleUrls: ['./header.component.less']
})

export class HeaderComponent implements OnInit {

  private _name = '';

  @Input()
  set name(name: string) {
    this._name = (name && name.trim()) || '<no name set>';
  }

  get name(): string { return this._name; }

  constructor(private router: Router, private global: GlobalService) { }

  onTitleClick() {
    this.router.navigate(['index-page']);
  }

  ngOnInit() {
    if (localStorage.getItem('info')) {
      this.global.symbol = true;
    }
  }

}
